load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fbcode_entropy_wardens_folly")

cpp_library(
    name = "codecs",
    exported_deps = [
        ":byte_to_message_decoder",  # @manual
        ":fixed_length_frame_decoder",  # @manual
        ":length_field_based_frame_decoder",  # @manual
        ":length_field_prepender",  # @manual
        ":line_based_frame_decoder",  # @manual
        ":message_to_byte_encoder",  # @manual
        ":string_codec",  # @manual
    ],
)

# Main Rules

cpp_library(
    name = "byte_to_message_decoder",
    headers = ["ByteToMessageDecoder.h"],
    exported_deps = [
        "//wangle/channel:handler",
    ],
)

cpp_library(
    name = "fixed_length_frame_decoder",
    headers = ["FixedLengthFrameDecoder.h"],
    exported_deps = [
        ":byte_to_message_decoder",
    ],
)

cpp_library(
    name = "length_field_based_frame_decoder",
    srcs = ["LengthFieldBasedFrameDecoder.cpp"],
    headers = ["LengthFieldBasedFrameDecoder.h"],
    exported_deps = [
        ":byte_to_message_decoder",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "length_field_prepender",
    srcs = ["LengthFieldPrepender.cpp"],
    headers = ["LengthFieldPrepender.h"],
    exported_deps = [
        "//folly/io:iobuf",
        "//wangle/channel:handler",
    ],
)

cpp_library(
    name = "line_based_frame_decoder",
    srcs = ["LineBasedFrameDecoder.cpp"],
    headers = ["LineBasedFrameDecoder.h"],
    exported_deps = [
        ":byte_to_message_decoder",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "message_to_byte_encoder",
    headers = ["MessageToByteEncoder.h"],
    exported_deps = [
        "//wangle/channel:handler",
    ],
)

cpp_library(
    name = "string_codec",
    headers = ["StringCodec.h"],
    exported_deps = [
        "//wangle/channel:handler",
    ],
)
